package com.zxy.personage.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zxy.personage.entity.ReplyEntity;
import com.zxy.personage.service.ReplyService;
import com.zxy.common.utils.PageUtils;
import com.zxy.common.utils.R;



/**
 * 回复用户表
 *
 * @author axy
 * @email sunlightcs@gmail.com
 * @date 2022-04-23 16:51:23
 */
@RestController
@RequestMapping("personage/reply")
@CrossOrigin
public class ReplyController {
    @Autowired
    private ReplyService replyService;

    /**
     * 列表
     */
    @RequestMapping("/list/{uname}")

    public R list(@RequestParam Map<String, Object> params,@PathVariable("uname") String uname){
        PageUtils page = replyService.queryPage(params,uname);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")

    public R info(@PathVariable("id") Integer id){
		ReplyEntity reply = replyService.getById(id);

        return R.ok().put("reply", reply);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody ReplyEntity reply){
		replyService.save(reply);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ReplyEntity reply){
		replyService.updateById(reply);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		replyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
